package main

import (
	"fmt"
)

func hanaaa(arr [5]int) (int, int) {
	sum := 0
	he := 0
	for i, v := range arr {
		he += v
		sum += i
	}
	return sum, he
}

func main() {
	//数组的声明
	var aaa [3]int
	bbb := [5]int{1, 2, 3, 4}
	//不带有计数
	ccc := [...]int{1, 2, 3, 4, 5, 6, 7, 8, 8}
	//二维数组,四行两列
	var ddd [4][2]int
	fmt.Println(aaa, bbb, ccc, ddd)

	//数组的遍历(for循环)
	for i := 0; i < len(bbb); i++ {
		fmt.Println(bbb[i])
	}
	//数组的遍历(一般)
	for i, v := range bbb {
		fmt.Println(i, v)
	}
	//数组在函数的调用
	// fmt.Println(aaa(aaa)) //因为aaa类型只有3个,而函数中需要是5个,所以报错
	fmt.Println(hanaaa(bbb))

	//循环中补:
	for i := 0; i <= 9; i++ {
		for a := 0; a <= i; a++ {
			fmt.Printf("%d*%d=%d ", a, i, a*i)
			if i == a {
				fmt.Println("\n")
			}
		}
	}
}
